home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-06-03 | 5.8 KB | 254 lines | [TEXT/PJMM] |
- unit TheMenus;
-
- interface
-
- uses
- aboutIt, howToView, viewerConstruct, gamePlay, Sound, SomeGlobals, Utilities, mainWndo, Initialize;
-
- procedure Handle_My_Menu (var doneFlag: boolean; theMenu, theItem: integer; var theInput: TEHandle); {Handle menu selection}
-
- implementation
-
- {=================================}
-
- procedure SetUp;
- var
- index: Integer;
- begin
- SetEventMask(playMask);
- FlushEvents(everyEvent, 0);
- HideCursor;
- DisableItem(GetMenu(AppleM), 0);
- DisableItem(GetMenu(GameM), 1);
- EnableItem(GetMenu(GameM), 2);
- EnableItem(GetMenu(GameM), 3);
- DisableItem(GetMenu(OptionsM), 0);
-
- levelOn := 1;
- gameOver := FALSE;
- enemiesPassed := 0;
- enemyMax := 10;
- enemySpeed := 6;
-
- SetShipsPos;
- oldLeftShip := leftShipDst;
- oldRightShip := rightShipDst;
- oldLeftCrossHair := leftCrossHairDst;
- oldRightCrossHair := rightCrossHairDst;
-
- PredefineEnemyRects;
- for index := 1 to numberOfEnemies do
- begin
- playerShot[index] := FALSE;
- enemyShot[index] := FALSE;
- currentEnemies[index, currentPointer] := index;
- currentEnemies[index, dataDimension] := index;
- end;
-
- chanPtr := nil;
- fireMode := 0;
- shields := 10;
- NumToString(shields, shieldString);
- theScore := 0;
- NumToString(theScore, scoreString);
- hoopOut := FALSE;
- hoopAngle := 1;
- hoopDistance := farthest;
- ComputeHoops;
-
- SetPort(mainWndo);
- PenNormal;
- TextFont(1);
- TextSize(9);
- TextMode(NotSrcCopy);
- MoveTo(141, 70);
- DrawString('Get your viewer');
- MoveTo(141, 80);
- DrawString('set up and ready.');
- MoveTo(141, 110);
- DrawString('Relax your eyes');
- MoveTo(141, 120);
- DrawString('until the two');
- MoveTo(141, 130);
- DrawString('images converge.');
- MoveTo(141, 165);
- DrawString('Click the mouse');
- MoveTo(141, 175);
- DrawString('when ready.');
-
- MoveTo(263, 70);
- DrawString('Get your viewer');
- MoveTo(263, 80);
- DrawString('set up and ready.');
- MoveTo(263, 110);
- DrawString('Relax your eyes');
- MoveTo(263, 120);
- DrawString('until the two');
- MoveTo(263, 130);
- DrawString('images converge.');
- MoveTo(263, 165);
- DrawString('Click the mouse');
- MoveTo(263, 175);
- DrawString('when ready.');
-
- repeat
- until (not button);
- repeat
- until (button);
- IntroEffects;
- end;
-
- {=================================}
-
- procedure Handle_My_Menu; {Handle menu selections realtime}
- const
- L_Apple = 201; {Menu list}
- C_About_Game = 1;
- L_Game = 202; {Menu list}
- C_Begin = 1;
- C_Pause = 2;
- C_End = 3;
- C_Quit = 5;
- L_Options = 203; {Menu list}
- C_Set_Controls = 1;
- C_Configure = 2;
- C_Help1 = 4;
- C_Help2 = 5;
- C_Help3 = 6;
- var
- DNA: integer;
- BoolHolder: boolean;
- DAName: Str255;
- SavePort: GrafPtr;
- err: OSErr;
-
- begin
- case theMenu of
- L_Apple:
- begin
- case theItem of
- C_About_Game:
- begin
- D_aboutIt;
- end;
- otherwise
- begin
- GetPort(SavePort);
- GetItem(AppleMenu, theItem, DAName);
- DNA := OpenDeskAcc(DAName);
- SetPort(SavePort);
- end;
- end;
- end;
- L_Game:
- begin
- case theItem of {Handle all commands in this menu list}
- C_Begin:
- begin
- playing := TRUE;
- pausing := FALSE;
- SetUp;
- end;
- C_Pause:
- begin
- pausing := not pausing;
- if pausing then
- begin
- ShowCursor;
- SetItem(GetMenu(GameM), 2, 'Continue');
- SetEventMask(idleMask);
- FlushEvents(everyEvent, 0);
- if (chanPtr <> nil) then
- begin
- err := SndDisposeChannel(chanPtr, FALSE);
- chanPtr := nil;
- end;
- end
- else
- begin
- HideCursor;
- SetItem(GetMenu(GameM), 2, 'Pause');
- SetEventMask(playMask);
- FlushEvents(everyEvent, 0);
- if (chanPtr <> nil) then
- begin
- err := SndDisposeChannel(chanPtr, FALSE);
- chanPtr := nil;
- end;
- end;
- end;
- C_End:
- begin
- ShowCursor;
- EnableItem(GetMenu(AppleM), 0);
- EnableItem(GetMenu(GameM), 1);
- DisableItem(GetMenu(GameM), 2);
- DisableItem(GetMenu(GameM), 3);
- EnableItem(GetMenu(OptionsM), 0);
- playing := FALSE;
- pausing := FALSE;
- SetEventMask(idleMask);
- FlushEvents(everyEvent, 0);
- end;
- C_Quit:
- begin
- ShowCursor;
- doneFlag := TRUE;
- playing := FALSE;
- pausing := FALSE;
- SetEventMask(EveryEvent);
- FlushEvents(everyEvent, 0);
- if (chanPtr <> nil) then
- begin
- err := SndDisposeChannel(chanPtr, FALSE);
- chanPtr := nil;
- end;
- end;
- otherwise
- begin
- end;
- end;
- end;
- L_Options:
- begin {Handle by using a Case statment}
- case theItem of {Handle all commands in this menu list}
- C_Set_Controls: {Sound actually}
- begin
- soundOn := not soundOn;
- if soundOn then
- SetItem(GetMenu(OptionsM), 1, 'Turn Off Sound')
- else
- SetItem(GetMenu(OptionsM), 1, 'Turn Sound On');
- end;
- C_Configure: {Actually game speed}
- begin
- slowOn := not slowOn;
- if slowOn then
- SetItem(GetMenu(OptionsM), 2, 'Speed It Up')
- else
- SetItem(GetMenu(OptionsM), 2, 'Slow It Down');
- end;
- C_Help1:
- begin
- D_viewerConstruct;
- end;
- C_Help2:
- begin
- D_howToView;
- end;
- C_Help3:
- begin
- D_gamePlay;
- end;
- otherwise
- begin
- end;
- end;
- end;
- otherwise
- begin
- end;
- end;
- HiliteMenu(0);
- end;
- end. {End of unit}